<?php
/**
 * @ClassName: MemberStatus
 * @Description: 会员状态枚举
 * @author: gydtrade
 * @Date: 2024-09-09 21:45
 * @Version: V1.0.0
 */

namespace app\common\enum;

class MemberStatus
{
    const CANCAL = -1;
    const DISABLE = 0;
    const NORMAL = 1;
    const LOCK = 2;

    /**
     * 状态 -1注销 0禁用 1正常 2锁定
     * @param $level
     * @return mixed|string|string[]
     */
    public static function text($level)
    {
        $desc = [
            MemberStatus::CANCAL => '注销',
            MemberStatus::DISABLE => '禁用',
            MemberStatus::NORMAL => '正常',
            MemberStatus::LOCK => '锁定',
        ];
        if ($level === true) {
            return $desc;
        }
        return isset($desc[$level]) ? $desc[$level] : $level;
    }

}